home *** CD-ROM | disk | FTP | other *** search
- '*************************************************
- '* Menu Routine Demo Program *
- '* *
- '* Written by: Robert R. Smith *
- '* 3812 Red Bud, Imperial MO 63052-1161 *
- '*************************************************
- '* CIS: 72447,2643 GEnie: R.SMITH138 *
- '*************************************************
- '* *
- '* Start up QuickBASIC with following parameters *
- '* *
- '* QB/l [drive:][\path]menurtns *
- '* *
- '*************************************************
-
- DEFINT A-Z
- 'Define Constants
-
- CONST True = 1
- CONST False = NOT True
-
- CONST Black = 0
- CONST Blue = 1
- CONST Green = 2
- CONST Cyan = 3
- CONST Red = 4
- CONST Magenta = 5
- CONST Brown = 6
- CONST White = 7
- CONST Bright = 8
- CONST Blink = 16
- CONST Yellow = Brown + Bright
-
- 'Declare Functions
-
- DECLARE FUNCTION GetDate$ ()
- DECLARE FUNCTION GetTime$ ()
- DECLARE FUNCTION MenuBar% (Row%, Col%, MenuStr$, MenuFore%, MenuBack%, Reversed%)
- DECLARE FUNCTION MenuWindow% (Row%, Col%, ShadDir$, MenuTitle$, MenuStr$, OutLine%, WColor%, WText%, Reversed%)
- DECLARE FUNCTION Shadow% (Row%, Col%)
- DECLARE FUNCTION WaitKey$ (Row%, Col%, WaitText$)
-
- 'Delcare Sub Routines
-
- DECLARE SUB DrawBox (URow%, UCol%, LRow%, LCol%, ShadDir$, MenuTitle$, OutLine%, WColor%, WText%)
-
- Esc$ = CHR$(27)
- Up$ = CHR$(0) + CHR$(72)
- PgUp$ = CHR$(0) + CHR$(73)
- Down$ = CHR$(0) + CHR$(80)
- PgDn$ = CHR$(0) + CHR$(81)
-
- KEY OFF
- COLOR White, Blue
- CLS
-
- 'Main loop
-
- CONST MainMenu$ = " Documentation Menu·window Time·display Date·display Quit "
- CONST Menu$ = " Shadow·box Menu·window·2 Time·display Date·display Quit "
- CONST SecondMenu$ = " Third·window·menu Middle·choice Last·choice Quit "
- CONST ThirdMenu$ = " This·is·the·first·choice·of·the·third·menu An·interesting·combination·of·functions Quit·menu "
- CONST Numbers$ = "A B C D E F G Q"
-
- VIEW PRINT 1 TO 25
-
- DO
- LOCATE , , 0
-
- MainTitle$ = "This menu is a combination of a MenuBar and Window"
- CALL DrawBox(2, 9, 4, 74, "l", MainTitle$, Blue, Cyan, White + Bright)
- SELECT CASE MenuBar%(3, 11, MainMenu$, Black, Cyan, Red + Bright)
-
- CASE 1 'This if a demonstration of shadowed box
- COLOR White, Blue
- CLS
- CALL DrawBox(9, 25, 13, 56, "L", "", Brown + Bright, Magenta, White + Bright)
- COLOR White + Bright, Magenta
- LOCATE 10, 29: PRINT "Please get printer ready"
- Dummy$ = WaitKey$(12, 29, "Press any key to continue")
- COLOR , Blue
- CLS
- CALL DrawBox(9, 25, 11, 56, "L", "", Brown + Bright, Magenta, White + Bright)
- COLOR White + Bright, Magenta
- LOCATE 10, 28, 0: PRINT "Printing.....Please Wait!!"
- SHELL "TYPE MENURTNS.DOC > PRN"
- LPRINT CHR$(12)
- CLS
-
- CASE 2 'This if the new Window Menu selection
- COLOR White, Blue
- DO
- FirstMenu$ = "N"
- SELECT CASE MenuWindow%(14, 10, "", "Menu·Window", Menu$, Cyan + Bright, Cyan, White + Bright, Blue)
- CASE 1
- CALL DrawBox(7, 30, 22, 65, "R", "Right Shadowed Box", Yellow, Brown, White + Bright)
- CASE 2
- DO
- EndSecondMenu$ = "N"
- SELECT CASE MenuWindow%(11, 23, "l", "Menu·Window·2", SecondMenu$, Green + Bright, Green, Yellow, White + Bright)
- CASE 1
- DO
- EndThirdMenu$ = "N"
- SELECT CASE MenuWindow%(7, 14, "r", "Third Test Window", ThirdMenu$, Blue + Bright, Cyan, Black, Red)
- CASE 1
- CASE 2
- DO
- EndLastMenu$ = "N"
- CALL DrawBox(12, 53, 21, 75, "L", "Interesting Combo", Yellow, Magenta, White + Bright)
- COLOR White, Magenta
- LOCATE 13, 55: PRINT "Menu Bar"
- LOCATE 14, 55: PRINT "Second Option"
- LOCATE 15, 55: PRINT "Third Option"
- LOCATE 16, 55: PRINT "Fourth Option"
- LOCATE 17, 55: PRINT "Fifth Option"
- LOCATE 18, 55: PRINT "Sixth Option"
- LOCATE 19, 55: PRINT "Last Option"
- LOCATE 20, 55: PRINT "Quit"
- SELECT CASE MenuWindow%(12, 47, "L", "", Numbers$, Yellow, Magenta, White + Bright, Black)
- CASE 1
- SELECT CASE MenuBar%(19, 15, Menu$, Black, Cyan, Red + Bright)
- END SELECT
- CASE 2
- CASE 3
- CASE 4
- CASE 5
- CASE 6
- CASE 7
- CASE ELSE
- EndLastMenu$ = "Y"
- END SELECT
- LOOP UNTIL EndLastMenu$ = "Y"
- CASE ELSE
- EndThirdMenu$ = "Y"
- END SELECT
- LOOP UNTIL EndThirdMenu$ = "Y"
- CASE 2
- CASE 3
- CASE ELSE
- EndSecondMenu$ = "Y"
- END SELECT
- LOOP UNTIL EndSecondMenu$ = "Y"
- CASE 3 'This will print the current time
- COLOR White, Blue
- LOCATE 22, ((80 - LEN(GetTime$)) / 2) - 10
- PRINT GetTime$; " at time of key press";
-
- CASE 4 'This will print the current date
- COLOR White, Blue
- LOCATE 23, ((80 - LEN(GetDate$)) \ 2) - 10
- PRINT GetDate$; " at time of key press"
-
- CASE ELSE
- FirstMenu$ = "Y"
- END SELECT
- LOOP UNTIL FirstMenu$ = "Y"
- COLOR White, Blue
- 'CLS
-
- CASE 3
- COLOR White, Blue
- CLS
- LOCATE 12, 28: PRINT "Press any key to continue"
- Response$ = ""
- DO
- Response$ = INKEY$
- LOCATE 10, 25: PRINT "The current time is now "; GetTime$
- LOOP WHILE Response$ = ""
- CLS
-
- CASE 4
- COLOR White, Blue
- CLS
- LOCATE 12, 28: PRINT "Press any key to continue"
- Response$ = ""
- DO
- Response$ = INKEY$
- LOCATE 10, 25: PRINT "Today's date is "; GetDate$
- LOOP WHILE Response$ = ""
- CLS
-
- CASE ELSE 'Exit loop
- quitFlag% = True
-
- END SELECT
- LOOP UNTIL quitFlag%
-
- 'Terminate Program
-
- COLOR White, Blue
- CLS
- END
-
-